home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH08 / PGM8_1B.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-10-14  |  1.3 KB  |  73 lines

  1. ; Well-formatted vs. Poorly formated programs.
  2. ;
  3. ; An example of a *really* poorly formatted program.
  4. ; Although this is an extreme example, it is possible
  5. ; to make your program difficult to read by only
  6. ; messing up the format of a few lines.
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. dseg        segment    para public 'data'
  14.  
  15.     ; Some type definitions for the variables we will declare:
  16.  
  17. uint typedef                word        ;Unsigned integers.
  18. integer              typedef    sword    ;Signed integers.
  19.  
  20.  
  21.     ; Some variables we can use:
  22.  
  23. j    integer    ?
  24.     k            integer        ?
  25.         l integer ?
  26.  
  27.             u1        uint    ?
  28. u2 uint                    ?
  29.     u3                    uint    ?
  30.  
  31.                             dseg ends
  32.  
  33.             cseg segment        para public 'code'
  34. assume cs:cseg, ds:dseg
  35.  
  36. Main        proc
  37.  mov ax,                             dseg
  38. mov        ds, ax
  39.   mov    es,                                 ax
  40.  
  41.                         ; Initialize our variables:
  42.  
  43.         mov    j, 3
  44.  mov k,                     -2
  45.  
  46. mov    u1,                         254
  47.         mov    u2, 22
  48.  
  49.                     ; Compute L := j+k and u3 := u1+u2
  50.  
  51.  mov            ax,                        J
  52. add                               ax,          K
  53.  mov                                    L, ax
  54.  
  55.    mov ax,             u1 ;Note that we use the "ADD"
  56.      add             ax,u2 ; instruction for both signed
  57.        mov    u3,                 ax ; and unsigned arithmetic.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.         Quit: mov        ah, 4ch ;DOS opcode to quit program.
  64. int                            21h ;Call DOS.
  65.     Main endp
  66.  
  67.                         cseg         ends
  68.  
  69.                 sseg        segment    para stack 'stack'
  70. stk byte 1024 dup ("stack   ")
  71.                         sseg        ends
  72.                             end    Main
  73.